#include <iostream>

using namespace std;

// 传递数组给函数，方式1：
void test1(double arr[], int size){
    for (int i = 0; i < size; i++)
    {
        cout << arr[i] << endl;
    }
}

// 传递数组给函数，方式2：
void test2(double arr[4]){
    for (int i = 0; i < 4; i++)
    {
        cout << arr[i] << endl;
    }
}

// 传递数组给函数，方式3：
void test3(double *arr){
    for (int i = 0; i < 5; i++)
    {
        cout << *(arr+i) << endl;
    }
}

// 从函数返回数组
double* test4(const double *arr){
    static double ret[5];
    for (int i = 0; i < 5; i++)
    {
        ret[i] = arr[i] + i;
    }
    return ret;
}

int main(){
    double balance[5] = {1000.0, 2.0, 3.4, 7.0, 50.0};

    for (auto &&i : balance)
    {
        cout << i << endl;
    }

    int a[3][4] = {0,1,2,3,4,5,6,7,8,9,10,11};

    for (auto &&i : a)
    {
        for (auto &&j : i)
        {
            cout << j << endl;
        }
        
    }

    double *ptr;
    ptr = test4(balance);
    
    
    
}